﻿script_info = {
	["title"] = "PCS官方",
	["version"] = "0.0.2",
	["description"] = "PCS官方限速通道",
	["color"] = "00FF1C",
}

function onInitTask(task, user, file)
    if task:getType() ~= TASK_TYPE_BAIDU then
        return false
    end
    if user == nil then
        task:setError(-1, "用户未登录")
		return true
	end
	local appid = 250528
    task:setUris("https://pcs.baidu.com/rest/2.0/pcs/file?method=download&path="..pd.urlEncode(file.path).."&app_id="..appid)
    task:setOptions("user-agent", "netdisk;6.9.5.1;PC;PC-Windows;6.3.9600;WindowsBaiduYunGuanJia")
    task:setOptions("header", "Cookie: "..user:getCookie())
    return true
end